<template>
  <el-container class="home-container">
    <!--头部-->
    <el-header>
      <div>
        <img src alt />
        <span>教师管理系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <!--页面主体-->
    <el-container>
      <!--侧边栏-->
      <el-aside width="200px">
        <!--侧边栏菜单-->
        <el-menu background-color="#333744" text-color="#fff" router>
          <!--一级菜单-->
          <el-submenu index="1">
            <!--一级菜单模板区-->
            <template slot="title">
              <!--图标-->
              <i class="el-icon-s-custom"></i>
              <!--文本-->
              <span>学生管理</span>
            </template>
            <!--二级菜单-->
            <el-menu-item-group>
              <el-menu-item
                v-for="(item,i) in stuList"
                :key="i"
                :index="item.name"
              >{{ item.navItem }}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <!--一级菜单模板区-->
            <template slot="title">
              <!--图标-->
              <i class="el-icon-reading"></i>
              <!--文本-->
              <span>课程管理</span>
            </template>
            <!--二级菜单-->
            <el-menu-item-group>
              <el-menu-item
                v-for="(item,i) in navList"
                :key="i"
                :index="item.name"
              >{{ item.navItem }}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        
          <el-menu-item index="persion">
            <i class="el-icon-edit"></i>
            <span slot="title">个人中心</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <!--右侧主体-->
      <el-main>
    <!-- <div>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item v-for="(item, index) in $route" :key="index" :to="item.path">{{item.name}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div> -->
        <!--路由占位符-->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      navList: [
        { name: "/kcgl", navItem: "课程中心" },
        { name: "/work", navItem: "作业批改" }
      ],
      stuList: [
        { name: "/grade", navItem: "学生成绩" },
        { name: "/homework", navItem: "作业情况" },
        { name: "/stuview", navItem: "学生报表" }
      ]
    };
  },
  methods: {
    logout() {
      window.sessionStorage.clear();
      this.$router.push("/");
    }
  }
};
</script>

<style scoped>
.home-container {
  height: 100%;
}

.el-header {
  background-color: #373d41;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  font-size: 20px;
}

.el-aside {
  background-color: #333744;
}

.ell-main {
  background-color: #eaedf1;
}
</style>
